import React, { useState ,useEffect } from 'react'

export default function App2() {
let [person, setPerson] = useState([{
    id: '001',
    name: '神里凌华'
}, {
    id: '002',
    name: '神里凌人'
}, {
    id: '003',
    name: '枫原万叶'
}])
useEffect(() => {
    console.log('setPerson执行了');
}, [person])
const addPerson = () => {
    setPerson([...person, { id: Date.now(), name: 'xxxxx' }])
}
return (
    <div>
        <button onClick={addPerson}>submit</button>
        <ul>
            {
                person.map(item => {
                    return <li key={item.id}>{item.name}</li>
                })
            }
        </ul>
    </div>
)
}
